package com.b.service.impl;

import com.b.repository.VideoTagRepository;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.SearchPage;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import com.b.dao.VideoTagMapper;
import com.b.domain.VideoTag;
import com.b.service.VideoTagService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class VideoTagServiceImpl implements VideoTagService{

    @Resource
    private VideoTagMapper videoTagMapper;
    @Resource
    private VideoTagRepository videoTagRepository;

    @Override
    @Transactional
    public boolean deleteByPrimaryKey(Integer id) {
        try {
            videoTagRepository.deleteById(id);
            videoTagMapper.deleteByPrimaryKey(id);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    @Override
    public int insert(VideoTag record) {
        return videoTagMapper.insert(record);
    }

    @Override
    public int insertSelective(VideoTag record) {
        return videoTagMapper.insertSelective(record);
    }

    @Override
    public VideoTag selectByPrimaryKey(Integer id) {
        return videoTagMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(VideoTag record) {
        return videoTagMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(VideoTag record) {
        return videoTagMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<VideoTag> getAll() {
        return videoTagMapper.getAll();
    }



}
